import axios from 'axios';

let base = 'api';

export const requestLogin = params => { return axios.post(`${base}/login`, params).then(res => res.data); };

export const getUserList = params => { return axios.get(`${base}/user/list`, { params: params }); };

export const getUserListPage = params => { return axios.get(`${base}/user/listpage`, { params: params }); };

export const removeUser = params => { return axios.get(`${base}/user/remove`, { params: params }); };

export const batchRemoveUser = params => { return axios.get(`${base}/user/batchremove`, { params: params }); };

export const editUser = params => { return axios.get(`${base}/user/edit`, { params: params }); };

export const addUser = params => { return axios.get(`${base}/user/add`, { params: params }); };
//登录
export const postUserLogin = params => { return axios.post('api/login?account='+params.account+"&password="+params.password, params ); };
//获取所有的新闻列表
export const getAllNews = params => { return axios.get('api/news/findAll?name='+params.name,  params  ); };
//假-删除一条新闻
export const deleteNewById = params => { return axios.delete('api/news/delete/'+params.id, params ); };
//更新一条新闻
export const postNewsUpdate = params => { return axios.post('api/news/update?img='+params.raw, params ); };
//增加一条新闻
export const postNewsAdd = params => { return axios.post('api/news/add', params ); };
//只获取用户名字
export const getUsername = params => { return axios.get('api/user/name/'+params.id, params ); };
//获取活动列表
export const getAllAct = params => { return axios.get('api/activity/findAll?name='+params.name,  params  ); };
//假-删除一条活动
export const deleteActivityById = params => { return axios.delete('api/act/delete/'+params.id, params ); };
//添加活动
export const postActAdd = params => { return axios.post('api/act/add', params ); };
//更新一条活动信息
export const postActUpdate = params => { return axios.post('api/act/update?img='+params.raw, params ); };
//获取审核列表
export const getAllCheck = params => { return axios.get('api/check/findAll?modelType='+params.model+"&name="+params.name,  params  ); };
//更新审核状态
export const putCheckType = params => { return axios.put('api/check/type/'+ params.id+'?type='+params.type,  params  ); };
//获取所有用户
export const getAllUser = params => { return axios.get('api/user/findAll?name='+params.name, params  ); };
//更新用户信息
export const putUpdateUser = params => { return axios.post('api/user/update', params  ); };
//获取文化人推荐列表
export const getAllCultrue = params => { return axios.get('api/cultrue/findAll?name='+params.name, params  ); };
//修改文化人信息
export const putUpdateCultrue = params => { return axios.post('api/cultrue/update', params  ); };
